package com.tepth.vehiclemaintenance.mvp.work.content;

import com.tepth.vehiclemaintenance.bean.MaintainDriverRemark;
import com.tepth.vehiclemaintenance.bean.MaintainListWork;
import com.tepth.vehiclemaintenance.net.ApiModel;
import com.tepth.vehiclemaintenance.net.Network;

import java.util.ArrayList;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by TMVPHelper on 2017/05/11
 */
public class ContentModel implements ContentContract.Model {

    @Override
    public Observable<ApiModel<ArrayList<MaintainDriverRemark>>> getDriverRemark(String authKey, int maintenanceId) {
        return Network.getApiService().getDriverRemark(authKey, maintenanceId)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<ApiModel<ArrayList<MaintainListWork>>> getMaintainListWork(String authKey, int maintenanceId) {
        return Network.getApiService().getMaintainListWork(authKey, maintenanceId)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<ApiModel<String>> punchCard(String authKey, int maintenanceId, String workContentsJson, String confirmJson, String completedRemark) {
        return Network.getApiService().punchCard(authKey, maintenanceId, workContentsJson,
                confirmJson, completedRemark)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}